<title>部门信息-编辑</title>
<div class="row">
	<div class="col-xs-12 depart_editor">
		<form class="form-horizontal registerform">
			<div class="space-4"></div>
			<div class="space-4"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label no-padding-right"
					for="form-field-name">部门名称：</label>
				<div class="input-group col-sm-9">
					<div class="in_txt">
						<input type="text" class="input-xlarge" datatype="*" id="hx_name"
							value="<?=$model['depart_name']?>" nullmsg="请输入部门名称"
							placeholder="请输入部门名称">
					</div>
					<div class="tishi">
						<div class="Validform_checktip"></div>
					</div>
				</div>
			</div>
			<div class="space-4"></div>
			<div class="clearfix form-actions">
				<div class="col-md-offset-3 col-md-9">
					<button class="btn btn-info save" type="button" id="btnSubmit">
						<i class="ace-icon fa fa-check bigger-110"></i>保存
					</button>
					&nbsp; &nbsp;
					<button class="btn" type="button">
						<i class="ace-icon glyphicon glyphicon-remove bigger-110"></i>取消
					</button>
					<input type="hidden" id="hx_id" value="<?=$model['id']?>" />
				</div>
			</div>

		</form>
	</div>
</div>
<script type="text/javascript">
var scripts = [null,null];
$('.page-content-area').ace_ajax('loadScripts', scripts, function(){
	//表单验证
	var $scope = $(".depart_editor");
	var vform=$(".registerform").Validform({
		tiptype:2
	});
	$("#btnSubmit",$scope).click(function(){
		if(!vform.check(false))
			return;	
	 var name=$("#hx_name",$scope).val();
	 var id = $("#hx_id",$scope).val(); 
	 $.post('/sys/ajax_depart_editor',{
		 	'id':id,
			'name':name
		},function(data){
			if(200===data.status)
			{
				message_box.show(data.data);
				gDialog.fClose();
				if ( typeof(pageObj) != "undefined" ) {		
					if(data.page<pageObj.get_page_count()){
						pageObj.dec_page_count();//-1
						if(pageObj.get_page_index() > pageObj.get_page_count()){
							pageObj.go_page(pageObj.get_page_count());
						}else{
							pageObj.cur_page();
						}
					  }else{
						pageObj.cur_page();
					  }		
				 }		
			}else
			{
			  message_box.show(data.data);
			}
			 
	},'json');
	});
})
</script>
